<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "category".
 *
 * @property int $cid
 * @property string $name
 * @property int $docnum
 */
class Category extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'category';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['cid', 'name'], 'required'],
            [['cid', 'docnum'], 'integer'],
            [['name'], 'string', 'max' => 128],
            [['cid'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'cid' => 'Cid',
            'name' => 'Name',
            'docnum' => 'Docnum',
        ];
    }
	   public function getUrl()
    {
    	return Yii::$app->urlManager->createUrl(
    			['doc/detail','did'=>$this->did,'title'=>$this->title]);
    }	
}
